# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-libacl
_pkgname=pylibacl
pkgver=0.7.0
pkgrel=2
pkgdesc="A python module for manipulating ACLs"
url="https://pylibacl.k1024.org/"
# s390x: segfault in tests
arch="all !s390x"
license="LGPL-2.0-or-later"
makedepends="py3-setuptools python3-dev acl-dev py3-gpep517"
checkdepends="py3-pytest"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-libacl" # Backwards compatibility
provides="py-libacl=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# TODO(ptrcnull): tests won't work in rootbld, because tmpfs doesn't support the same extended ACLs (i think?)
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
077515a00c7a048faf7792acd9c3e768d35674c0b3f4ec72fdf37561c90ed12bb392582a4fb9a23b7916db3375278c2636f2844f362a8335e7ad68e1e9b9c3bd  pylibacl-0.7.0.tar.gz
"
